﻿<Window x:Class="LaunchMeNot.WinLaunch"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:loc="clr-namespace:LaunchMeNot" 
        xmlns:conv="clr-namespace:LaunchMeNot.Converters" 
        xmlns:Core="clr-namespace:LaunchMeNot.Core;assembly=LaunchMeNot.Core" 
        xmlns:props="clr-namespace:LaunchMeNot.Properties" 
        xmlns:l49ui="clr-namespace:Lime49.UI;assembly=Lime49" 
        xmlns:lex="http://schemas.root-project.org/xaml/presentation"
        MinWidth="150" Width="400" MinHeight="150" Height="200" MaxHeight="600"  SizeToContent="Height"
        Title="LaunchMeNot" Loaded="Window_Loaded" KeyDown="Window_KeyDown"
        Style="{StaticResource {x:Type Window}}" Icon="pack://application:,,,/Resources/icon.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Help" Executed="ShowHelp"/>
        <CommandBinding Command="loc:LaunchMeNotCommands.Abort" Executed="Abort" CanExecute="CanAbort"/>
        <CommandBinding Command="loc:LaunchMeNotCommands.Launch" Executed="Launch" CanExecute="CanLaunch"/>
    </Window.CommandBindings>
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="LaunchStyles.xaml"/>
                <ResourceDictionary>
                    <BitmapImage x:Key="help_16" UriSource="pack://application:,,,/Resources/Images/question_16.png"/>
                    <props:Settings x:Key="settings"/>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <ProgressBar DockPanel.Dock="Bottom" x:Name="prgStatus" IsIndeterminate="True" MinHeight="16"/>
        <Grid DockPanel.Dock="Top" Margin="6" DataContext="{StaticResource settings}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <loc:CountdownTimer x:Name="countdownTimer" TimeRemaining="{Binding Default.LaunchDelay}" />
            <TextBlock Grid.Row="0" x:Name="lblStatus" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
            <l49ui:ImageButton Grid.Row="0" Grid.Column="1" Image="{StaticResource help_16}" Command="ApplicationCommands.Help" ShowText="False" AlwaysShowBorder="False" Padding="0" Style="{StaticResource ToolBarButton}" VerticalAlignment="Center"
                               Text="{lex:LocText LaunchMeNot.Core:Strings:About}" ToolTip="{lex:LocText LaunchMeNot.Core:Strings:About}"/>

            <TextBlock Grid.Row="1" Grid.ColumnSpan="2" x:Name="txtCountdown" Style="{StaticResource TimerStyle}" Text="{Binding ElementName=countdownTimer,Path=TimeRemaining.Seconds,StringFormat={}{0:0}}" TextAlignment="Center"/>
            <ListBox Grid.Row="2"  Grid.ColumnSpan="2" x:Name="lstEntries" Style="{StaticResource PendingLaunchList}" ScrollViewer.CanContentScroll="True" />

            <Button Grid.Row="3" Grid.ColumnSpan="2" Command="loc:LaunchMeNotCommands.Abort" HorizontalAlignment="Stretch">
                <TextBlock Text="Abort" Padding="20,10" FontWeight="Bold" FontSize="18" HorizontalAlignment="Center"/>
            </Button>
        </Grid>
    </DockPanel>
</Window>
